<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*
        1.使用
     */

    class Foo {
        constructor(values) {
            this.values = values
        }

        * [Symbol.iterator]() {
            yield* this.values
        }
    }
    
    const f = new Foo([1,2,3])
    for(const x of f){
        console.log(x)  // 1 2 3 
    }
    
    
</script>
</body>
</html>